#ifndef _MESSAGES_H_
#define _MESSAGES_H_

#include <defs.h>

// Request types
#define DELAY_REQUEST         0   // Delay()
#define TIME_REQUEST          1   // Time()
#define DELAY_UNTIL_REQUEST   2   // DelayUntil()

// Clock requests (e.g. from system requests)
typedef struct __clock_req {
  int type;
  int ticks;
} clock_req;

/*
// Requests to the engine server
typedef struct __engine_req {
  int type;
  int speed;
  sensor last;
} engine_req;
*/

// Request types
#define WHO_IS_REQUEST        0
#define REGISTER_AS_REQUEST   1

// Reply errors
#define ERROR_TASK_NOT_FOUND  -1
#define ERROR_TABLE_FULL      -2

typedef struct __name_req {
  int type;
  char name[MAX_NAME_LEN];
} name_req;

#define STALLED   0
#define TXREADY   1

typedef struct __rx_reply {
  int ch;
} rx_reply;

#define REQ_BUFFER  0
#define REQ_STATUS  1

#define TX_INT  0
#define MS_INT  1

typedef struct __train_tx_req {
  int state;
  char ch;
} train_tx_req;

typedef struct __train_tx_reply {
  int len;
  int buf[16];
} train_tx_reply;

#endif
